package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
public class TestController {
    @RequestMapping("test")
    public String test(HttpServletRequest req){
        //绑定共享数据
        req.setAttribute("name","张三");
        req.setAttribute("age",20);
        List<UserBean> list = new ArrayList<>();
        list.add(new UserBean(1,"君君","184566876589"));
        list.add(new UserBean(2,"包包","184566876589"));
        list.add(new UserBean(3,"图图","184566876589"));
        list.add(new UserBean(4,"溜溜","184566876589"));
        list.add(new UserBean(5,"文文","184566876589"));
        req.setAttribute("lists",list);
        //请求转发到指定页面
        return "/showInfo.html";
    }
}
